﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MudEngine.Parsing.AST
{
    public enum ArrayRangeType
    {
        Default = 0,
        FromEnd = 1
    }

    public class IndexedIdentifierExpression : Expression
	{
		public Expression Identifier { get; private set; }
        public ArrayRangeType IndexType { get; private set; }
		public Expression Index { get; private set; }
        public ArrayRangeType RangeEndType { get; private set; }
        public Expression RangeEnd { get; private set; }

        public IndexedIdentifierExpression(Expression identifier, ArrayRangeType indexType, Expression index, ArrayRangeType rangeEndType, Expression rangeEnd)
		{
			this.Identifier = identifier;
			this.Identifier.Parent = this;
            this.IndexType = indexType;
			this.Index = index;
			this.Index.Parent = this;
            this.RangeEndType = rangeEndType;
			this.RangeEnd = rangeEnd;
			if (this.RangeEnd != null)
				this.RangeEnd.Parent = this;
		}

		public override void AcceptVisitor<C>(IAstNodeVisitor<C> visitor, C ctx)
		{
			visitor.VisitIndexedIdentifierExpression(this, ctx);
		}
	}
}
